<template>
  <div class="menu">
    <el-card
      class="menu_item"
      v-for="(item, index) in menuList"
      :key="index"
      shadow="hover"
      :header="item.title"
      @click="goPage(item)"
    >
      <template #header>
        <span class="title">{{ item.title }}</span>
      </template>
      <span class="content">{{ item.des }}</span>
    </el-card>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
const props = defineProps({
  menuList: {
    type: Array,
    default: () => [],
  },
})
const goPage = (item) => {
  if (item.link) {
    window.open(item.link)
  } else {
    router.push(item.path)
  }
}
</script>

<style lang="scss" scoped>
.menu {
  display: grid;
  justify-content: space-around;
  grid-template-columns: repeat(auto-fill, 360px);
  gap: 20px;

  &_item {
    cursor: pointer;

    .title {
      font-size: 26px;
      font-weight: bold;
    }

    .subtitle {
      padding-left: 10px;
    }

    .content {
      font-size: 14px;
    }
  }
}
</style>
